home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / tools / gedscripts / pastex / nexterror.ged < prev    next >
Text File  |  1995-03-09  |  2KB  |  88 lines

  1. /* Skip to next TeX error --- take filename and line-number of the current
  2. window look for logfile. Then look for last word on the first halfline and then
  3. get that word and search for it. So the cursor should get to the error at once.
  4.  
  5. Done by:
  6.  
  7. R.Laederach
  8. Kappelisackerstr. 46
  9. 3063 Ittigen
  10. Switzerland
  11. Phone:+41/(0)31/912 19 08
  12.  
  13. This stuff ist PD, so do what you want.
  14. */
  15.  
  16. ADDRESS "GOLDED.1"
  17.  
  18. LOCK CURRENT
  19.  
  20. OPTIONS RESULTS
  21.  
  22. 'QUERY DOC'
  23. fullname = RESULT
  24.  
  25. basename = (left(fullname, LENGTH(fullname)-4))
  26. extension = translate(right(fullname, 4) , xrange('a','z'), xrange('A','Z'))
  27.  
  28.  
  29. IF extension ~= ".tex" THEN DO
  30.     'REQUEST BODY="I need a .tex file"'
  31.     UNLOCK
  32.     EXIT 5
  33. END
  34.  
  35. logname = basename||".log"
  36.  
  37. 'QUERY LINE'
  38. currentline = RESULT + 1
  39.  
  40. 'REQUEST HIDE = TRUE'
  41.  
  42. 'WINDOW USE' logname
  43.  
  44. notok = (RC ~= 0)
  45.  
  46. if (notok) THEN DO
  47.     'MORE'
  48.     'OPEN NAME' logname
  49.     'WINDOW HEIGHT' 80
  50.     END
  51.  
  52. 'REQUEST HIDE = FALSE'
  53.  
  54. 'GOTO TOP'
  55.  
  56. number = 0
  57. found = 1
  58. DO WHILE(found & number <= currentline)
  59.     'FIND NEXT QUIET STRING="l."'
  60.     found = (RC = 0)
  61.     if (found) THEN DO
  62.         OPTIONS RESULTS
  63.         'QUERY BUFFER'
  64.         parse var RESULT "l." number errorstring
  65.         IF "" ~= errorstring THEN DO
  66.             wordnumber = WORDS(errorstring)
  67.             errorword = WORD(errorstring,wordnumber)
  68.             /* say errorstring
  69.             say errorword
  70.             say wordnumber >I used that for debugging */
  71.             END
  72.     END
  73.  
  74. END
  75.  
  76. 'WINDOW USE' fullname
  77. IF 0~= number & number > currentline THEN DO
  78.     'GOTO LINE' number
  79.     FIRST
  80.     'FIND QUIET NEXT STRING='||errorword
  81.     UNLOCK
  82.     END
  83. else DO
  84.     'REQUEST BODY="No more errors."'
  85. UNLOCK
  86. END
  87.  
  88.